package com.aaa.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;


import java.util.Collection;


/**
 * @ClassName: AuthUser
 * @Description: TODO
 * @Author: 86139
 * @Date: 2021/9/3 12:00
 * @Version:1.0
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("back_user")
public class AuthUser implements UserDetails {
    @TableId(type = IdType.AUTO)
    private Integer uid	;
    private String uname	;
    private String username	;
    private String password	;
    private String phone	;
    private String sex	;

    private String birthday	;
    private String photo	;
    private Integer rid;
    private  Integer state;
    private Collection authorities;//权限


    public Collection<? extends GrantedAuthority> setAuthorities(Collection collection) {
        return this.authorities=collection;
    }


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }



}
